package top.juanshen.print.util;

import java.util.Map;
import java.util.regex.Matcher;

/**
 * @author yanjuan
 * @date 17/11/8 下午6:49
 */
public class MatherUtil {

    public static void match(Matcher matcher,Map<String, Object> keyMap,StringBuffer sb){
        while (matcher.find()) {
            String key = matcher.group(1);
            if(keyMap.containsKey(key)){
                matcher.appendReplacement(sb, keyMap.get(key)+"");
            }else{
                System.out.println("keyMap has not found : " + key);
            }
        }
    }
}
